#include <iostream>
#include <vector>
#include <string>

#define MODN 10007
using namespace std;

bool s[10100];

int hash(string x) {
	int res = 0;
	for (int i = 0; i < x.size(); ++i) {
		res += x[i] * (i + 1);
		res %= MODN;
	}
	return res;
}

string x;

int main() {
	int n, m;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> x;
		s[hash(x)] = 1;
	}
	cin >> m;
	for (int i = 1; i <= m; ++i) {
		cin >> x;
		if (s[hash(x)]) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}